package cn.kgc.service;

import cn.kgc.dao.BillMapper;
import cn.kgc.entity.Bill;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2020/3/12.
 */
@Service
public class BillServiceImpl implements BillService {

    @Autowired
    private BillMapper billMapper;

    public PageInfo<Bill> queryByBill(Bill bill, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Bill> list = billMapper.queryByBill(bill);
        PageInfo<Bill> pageInfo = new PageInfo<Bill>(list);
        return pageInfo;
    }

    public Integer save(Bill bill) {
        return billMapper.save(bill);
    }

    public Bill queryById(Integer id) {
        return billMapper.queryById(id);
    }

    public Integer delete(Integer id) {
        return billMapper.delete(id);
    }
}
